// 移动端菜单切换（可自行扩展）
document.addEventListener('DOMContentLoaded', function() {
    const navbar = document.querySelector('.navbar');
    window.addEventListener('scroll', function() {
        if (window.scrollY > 50) {
            navbar.style.background = 'rgba(255,255,255,0.95)';
        } else {
            navbar.style.background = 'rgba(255,255,255,0.95)';
        }
    });
});

// 图片悬停效果
document.querySelectorAll('.grid-item').forEach(item => {
    item.addEventListener('mouseover', () => {
        item.querySelector('.image-info').style.transform = 'translateY(0)';
    });
    
    item.addEventListener('mouseout', () => {
        item.querySelector('.image-info').style.transform = 'translateY(100%)';
    });
});

// 表单验证
document.querySelector('.contact-form').addEventListener('submit', function(e) {
    e.preventDefault();
    const name = this.querySelector('input[type="text"]').value;
    const email = this.querySelector('input[type="email"]').value;
    const message = this.querySelector('textarea').value;

    if (!name || !email || !message) {
        alert('请填写所有必填字段');
        return;
    }

    // 这里可以添加实际提交逻辑
    alert('消息已发送！');
    this.reset();
});

// 移动端菜单
const menuToggle = document.createElement('div');
menuToggle.className = 'menu-toggle';
menuToggle.innerHTML = '☰';
document.querySelector('.navbar').appendChild(menuToggle);

menuToggle.addEventListener('click', () => {
    document.querySelector('.nav-links').classList.toggle('active');
});

